<template>
  <div>
    <div class="main">
      <div class="banner">
        <swiper :indicator-dots="indicatorDots"
                :autoplay="autoplay" :interval="interval" :duration="duration">
          <block v-for="item in imgUrls">
            <swiper-item>
              <image :src="item" class="slide-image" mode="aspectFit"/>
            </swiper-item>
          </block>
        </swiper>
        <div class="title">
          官方旗舰店安踏童装 男小童针织运动套装 儿童套装小童运动服两件套装35734947 淡蓝色-2 120cm
        </div>
        <div class="list">
          <div class="list-top">
            <span class="red">￥179.00</span>
            <span class="del">￥ 268.00</span>
            <span>一手5件</span>
          </div>
          <div class="list-bottom">
            <span class="lf">尺码：120-160</span>
            <span class="rt">净重：3.5kg</span>
          </div>
        </div>
      </div>
      <div class="hr"></div>
      <div>
        <div v-for="(item,index) in parentMsg">
          <img :src="item.src" :style="{width: '750rpx',height: item.height * 2 +'rpx'} ">
        </div>
      </div>
    </div>
    <ul class="foot">
      <li class="foot-list">
        <div class="foot-list-lf">
          <div class="foot-kefu">
            <image :src="iconkefu"/>
            <p>客服</p>
          </div>
        </div>
        <div class="foot-list-rt">
          <div class="foot-gouwu">
            <image :src="icon2"/>
            <div class="weui-badge foot-gouwu-badge">9</div>
          </div>
          <p>购物车</p>
        </div>
      </li>
      <li>
        <button class="btn yellow" type="warn" @click="btnclick"> 加入购物车 </button>
      </li>
      <li>
        <button class="btn" type="warn" @click="btnclick"> 我要预定 </button>
      </li>
    </ul>
    <shopcart :show="showed"></shopcart>
  </div>
</template>

<script>
import shopcart from '../../components/shopcart.vue'
export default {
  data () {
    return {
      imgUrls: [
        'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
        'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
        'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
      ],
      indicatorDots: true,
      autoplay: false,
      interval: 5000,
      duration: 1000,
      imageWidth: '',
      imageHeight: '',
      parentMsg: '',
      icon2: '',
      iconkefu: '',
      showed: 0
    }
  },
  components: {
    shopcart
  },
  computed: {

  },
  methods: {
    btnclick () {
      this.showed = 1
    }
  },
  mounted () {
    this.parentMsg = [{
      src: 'https://www.ausck.com/ueditor/php/upload/image/20180403/1522770852573291.jpg',
      width: 441,
      height: 1234
    }]
    this.icon2 = require('./yushou2.png')
    this.iconkefu = require('./yushou_kefu.png')
  },
  created () {
    // 调用应用实例的方法获取全局数据
  },
  onLoad () {
    this.showed = 0
  },
  onReady () {

  }
}
</script>

<style lang="less" rel="stylesheet/less" scoped>
  .main{
    height: calc(100vh - 100rpx);
    overflow-y: scroll;
    .banner{
      swiper{
        height: 700rpx;
      }
      .title{
        padding: 20rpx 100rpx 20rpx 20rpx;
        font-size: 28rpx;
      }
      .list{
        padding: 0 20rpx 20rpx;
        font-size: 36rpx;
        .list-top{
          .red{
            color: #E93B3D;
            margin-right: 10rpx;
          }
          .del{
            margin-right: 20rpx;
            text-decoration: line-through;
          }
        }
        .list-bottom{
          height: 56rpx;
          .lf{
            float: left;
          }
          .rt{
            margin-right: 30rpx;
            float: right;
          }
        }
      }
    }
    .hr{
      width: 750rpx;
      height: 30rpx;
      background: #f8f8f8;
    }
    .main-img{
      width: 750rpx;
      height: 0;
    }
  }
  .foot{
    display: flex;
    flex-direction: row;
    .foot-list{
      display: flex;
      width: 330rpx;
      flex-direction: row;
      align-items: center;
      justify-content: center;
      font-size: 24rpx;
      color: #999;
      .foot-list-lf,.foot-list-rt{
        display: flex;
        width: 165rpx;
        height: 100rpx;
        text-align: center;
        align-items: center;
        justify-content: center;

      }
      .foot-list-lf{
        .foot-kefu{
          image{
            display: block;
            width: 50rpx;
            height: 50rpx;
          }
        }
        &:active{
          background: #cccccc;
        }
      }

      .foot-list-rt{
        display: flex;
        flex-direction: column;
        &:active{
          background: #cccccc;
        }
        .foot-gouwu{
          position: relative;
          image{
            display: block;
            width: 50rpx;
            height: 50rpx;
          }
          .foot-gouwu-badge{
            position: absolute;
            top:-4rpx;
            right: -25rpx;
          }
        }
      }
    }

    button.btn{
      width: 210rpx;
      line-height: 100rpx;
      padding: 0;
      border-radius: 0;
    }
    .yellow{
      background: #FF9600;
    }
  }

</style>
